﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;
using Deixei.Common;

namespace Deixei.Web
{
    public class DeixeiWebContext
    {

        private UrlHelper urlHelper;

        public DeixeiWebContext(RequestContext requestContext)
        {
            this.Initialize(requestContext);
        }


        private void Initialize(RequestContext requestContext)
        {
            CommonUtil.CheckForNull(requestContext, "requestContext");
            this.RequestContext = requestContext;
            RouteData routeData = requestContext.RouteData;

        }

        public RequestContext RequestContext
        {
            get;
            private set;
        }

        public string RootPath
        {
            get
            {
                return VirtualPathUtility.ToAbsolute("~/");
            }
        }
        
        public UrlHelper Url
        {
            get
            {
                if (this.urlHelper == null)
                {
                    this.urlHelper = new UrlHelper(this.RequestContext);
                }
                return this.urlHelper;
            }
        }
    }
}
